PBHCreateSync
PBHCreate Create an empty file (HFS only)
#include <Files.h> File Manager (PBxxx)
OSErr PBHCreate(pb, async ); Boolean async ; 0=await completion; 1=immediate return PBHCreate creates both forks of a 0-length file. It is the same as
PBCreate, except that you can use a directory ID to identify a directory and
file version numbers are ignored. Use PBHSetFInfo to supply de scriptive
information about the file. The file is NOT opened by this call.
pb is the address of an 80-byte HFileParam structure (or the fields are as follows:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) -> ioNamePtr StringPtr 4 18 Address of full or partial path/ filename -> ioVRefNum short 2 22 Volume or working directory reference
-> ioFlVersNum char 1 31 File version (always set to 0)
-> ioDirID long 4 48 ID of directory (0=use ioVRefNum)
<- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet) async is a Boolean value. Use FALSE for normal (synchronous) operation or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
bdNamErr (-37) Bad name
dirFulErr (-33) Directory full
dirNFErr (-120) Directory not found
dupFNErr (-48) Duplicate filename already exists
extFSErr (-58) External file system
ioErr (-36) I/O error
nsvErr (-35) No such volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected
Notes: As with PBCreate, only part of the file's de scriptive information is
filled-in. You should follow this call with one to PBHSetFInfo so the
correct icon will be displayed by the Finder, etc. (you can skip this for
temporary files).
If you use a directory ID in ioDirID, it will override any volume or
working-directory number in ioVRefNum. If you wish to use a working
directory reference (as obtained via Standard File), put it in ioVRefNum
and use ioDirID=0.
The ioFlVersNum field should always be set to 0 for normal Macintosh files. There are a number of parts of the Macintosh System that will not
deal correctly with files that have the wrong version: the
files that have a non-zero ioFlVersNum. This is not actually a problem
unless a file is being created on an MFS disk. However, it is better safe than
confused.
Use PBDirCreate if you wish to create a new directory. The higher-level Create function lets you set the document type and creator ID in the call.